package info.nene_loveplus.controller.pub;

import info.nene_loveplus.meta.LinkMeta;
import info.nene_loveplus.model.Link;

import java.util.List;

import org.slim3.controller.Controller;
import org.slim3.controller.Navigation;
import org.slim3.datastore.Datastore;

public abstract class AbstractPubController extends Controller {

	@Override
	protected Navigation run() throws Exception {
		Navigation result = doRun();

		List<Link> links = Datastore.query(Link.class)
				.sort(LinkMeta.get().sortOrder.asc.getSort()).asList();
		requestScope("links", links);

		return result;
	}

	protected abstract Navigation doRun() throws Exception;
}
